/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.me.cine25;

import android.app.Activity;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import java.util.LinkedList;
import android.graphics.Bitmap;
import android.view.LayoutInflater;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

/**
 *
 * @author Jesus
 */
public class ImageAdapter extends BaseAdapter {

    private Activity c;
    private LinkedList<Pelicula> list;
    private int modo;

    public ImageAdapter(Activity c, LinkedList<Pelicula> list,int modo) {
        this.c = c;
        this.list = list;
        this.modo=modo;
        Toast.makeText(c, this.list.size(), Toast.LENGTH_SHORT).show();
    }

    public int getCount() {
        return this.list.size();
    }

    public Object getItem(int position) {
        return position;
    }

    public long getItemId(int arg0) {
        return arg0;
    }

    public View getView(int arg0, View arg1, ViewGroup arg2) {
        LayoutInflater inflater = c.getLayoutInflater();
        View item = null;
        
        if(this.modo==0){
            item = inflater.inflate(R.layout.ultima_pelicula_element, null);
        }else{
            item = inflater.inflate(R.layout.ultimapeliculavista, null);
            //((TextView)item.findViewById(R.id.Fecha)).setText("Usuario");
            //ImageView a = (ImageView) item.findViewById(R.id.Icono);
            //a.setImageResource(R.drawable.icono);
        }
        
        
        //((ImageView) item.findViewById(R.id.Image)).setImageBitmap(list.get(arg0).getImagen());
        //a.setImageResource(myImageIds[arg0]);
        //((TextView) item.findViewById(R.id.TituloNuevaPelicula)).setText(list.get(arg0).getTitulo());
        //((TextView)item.findViewById(R.id.UsuarioNuevaPelicula)).setText(list.get(arg0).getDirector());
        
        return item;
    }
}
